package com.itheima.demo07;

/**
 * @author Zhang_Han
 * @version 1.0
 * @date 2020/7/14 14:02
 */
public class MyThread01 implements Runnable {
    private int count = 0;
    private final Object lock = new Object();
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            synchronized (lock) {
                count++;
                System.out.println("已经送了" + count + "个冰激凌!");
            }
        }
    }
}
